<?php
/**
 * Each engineer has a duty to keep the code elegant
 * Created by wolffy.
 * Author @wolffy<13750088090@sina.cn>
 * Date: 2018/12/12
 * Time: 10:25
 */
namespace App\Http\Controllers\BackendApi;

use App\Http\Requests\BackendApi\RepaymentDetailRequest;
use App\Http\Requests\BackendApi\UserInfoRequest;
use App\Services\BackendApi\InvitedService;
use App\Services\BackendApi\RepaymentService;
use App\Services\BackendApi\UserService;
use Illuminate\Http\Request;

class RepaymentController extends ApiController
{
    protected $repaymentService;

    public function __construct(RepaymentService $repaymentService)
    {
        $this->repaymentService = $repaymentService;
    }

    public function getList(Request $request)
    {
        return $this->repaymentService->getList($request);
    }

    /**
     * 还款计划详情
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     */
    public function getDetail(RepaymentDetailRequest $repaymentDetailRequest)
    {
        return $this->repaymentService->repaymentPlanDetail($repaymentDetailRequest->plan_id, $repaymentDetailRequest->user_id);
    }

    public function jobEdit()
    {
        return $this->repaymentService->jobEdit();
    }

    public function jobUpdate(Request $request)
    {
        return $this->repaymentService->jobUpdate($request->type, $request->value);
    }
}